<template>
  <div class="hotGoods">
    <h2>热卖商品</h2>

    <div class="content">
      <ul class="clearFix">
        <li v-for="item of hotGoods" :key="item.goodsId">
          <router-link :to="{path:'/details',query:{id:item.goodsId}}">
            <van-image class="image" :src="$filterImage(item.image)" lazy-load>
              <template v-slot:loading>
                <van-loading type="spinner" size="20" />
              </template>
            </van-image>
          </router-link>
          <p class="name">{{item.name}}</p>
          <p class="price">{{item.price | toFixed | rmb}}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      hotGoods: []
    };
  },
  created() {
    this.$eventBus.$on("getIndexInfo", res => {
      this.hotGoods = res.hotGoods;
    });
  }
};
</script>

<style lang="scss">
@import "@/style/home/hotGoods";
</style>